#pragma once

#ifndef FEATURE_H
#define FEATURE_H

#include <memory>
#include <opencv2/features2d.hpp>
#include "common.h"

namespace myslam{
struct  Frame;
struct  MapPoint;

/****
 * 2D特征点
 * 在三角化后会被关联到一个地图点
 */

struct Feature{
public:
    EIGEN_MAKE_ALIGNED_OPERATOR_NEW;
    typedef std::shared_ptr<Feature>    Ptr;
    
    std::weak_ptr<Frame> frame_;                      //持有该feature的frame
    cv::KeyPoint positin_;                            //2d提取位置     
    std::weak_ptr<MapPoint> map_point_;               //关联地图点
    
    bool is_outline_=false;                           //是否为异常点
    bool is_on_left_image_=true;                      //标识是否提在左图，false为右图
public:
    Feature() {}
    Feature(std::shared_ptr<Frame> frame, const cv::KeyPoint &kp)
            :frame_(frame),positin_(kp){}
};
}
#endif // FEATURE_H
